package com.imooc.handler;

import com.imooc.VO.ResultVO;
import com.imooc.exception.SellException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author liuhuan
 * @date 2018/7/28 10:51
 * @description
 */
@ControllerAdvice
public class SellExcpetionHandler {

    @ExceptionHandler(value = SellException.class)
    @ResponseBody
    @ResponseStatus
    public ResultVO handleSellerException(SellException e){
        return ResultVO.fail(e.getCode(),e.getMessage());
    }

}
